/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.OneCommerceProject.entities;

import java.io.Serializable;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Date;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Aymen
 */
@Entity
@Table(name = "COMMANDECLIENT", catalog = "", schema = "AYMEN")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Commandeclient.findAll", query = "SELECT c FROM Commandeclient c"),
    @NamedQuery(name = "Commandeclient.findByIdcommande", query = "SELECT c FROM Commandeclient c WHERE c.idcommande = :idcommande"),
    @NamedQuery(name = "Commandeclient.findByQuantite", query = "SELECT c FROM Commandeclient c WHERE c.quantite = :quantite"),
    @NamedQuery(name = "Commandeclient.findByDateReser", query = "SELECT c FROM Commandeclient c WHERE c.dateReser = :dateReser"),
    @NamedQuery(name = "Commandeclient.findByStatutreser", query = "SELECT c FROM Commandeclient c WHERE c.statutreser = :statutreser"),
    @NamedQuery(name = "Commandeclient.findByIdutil", query = "SELECT c FROM Commandeclient c WHERE c.idutil = :idutil"),    
    @NamedQuery(name = "Commandeclient.findByEtatcomm", query = "SELECT c FROM Commandeclient c WHERE c.etatcomm = :etatcomm")})
public class Commandeclient implements Serializable {
    private static final long serialVersionUID = 1L;
    public static final String FIND_BY_UTIL = "Commandeclient.findByIdutil";
    public static final String FIND_BY_STATUTRESER = "Commandeclient.findByStatutreser";
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "IDCOMMANDE", nullable = false, precision = 22, scale = 0)
    @GeneratedValue(strategy= GenerationType.AUTO)
    private BigDecimal idcommande;
    @Basic(optional = false)
    @NotNull
    @Column(name = "QUANTITE", nullable = false)
    private BigInteger quantite;
    @Basic(optional = false)
    @NotNull
    @Column(name = "DATE_RESER", nullable = false)
    @Temporal(TemporalType.DATE)
    private Date dateReser;
    @Size(max = 50)
    @Column(name = "STATUTRESER", length = 50)
    private String statutreser;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "ETATCOMM", nullable = false, length = 50)
    private String etatcomm;
    @JoinColumn(name = "IDUTIL", referencedColumnName = "IDUTIL", nullable = false)
    @ManyToOne(optional = false)
    private Utilisateur idutil;
    @JoinColumn(name = "IDITEM", referencedColumnName = "IDITEM", nullable = false)
    @ManyToOne(optional = false)
    private Item iditem;

    public Commandeclient() {
    }

    public Commandeclient(BigDecimal idcommande) {
        this.idcommande = idcommande;
    }

    public Commandeclient(BigDecimal idcommande, BigInteger quantite, Date dateReser, String etatcomm) {
        this.idcommande = idcommande;
        this.quantite = quantite;
        this.dateReser = dateReser;
        this.etatcomm = etatcomm;
    }

    public BigDecimal getIdcommande() {
        return idcommande;
    }

    public void setIdcommande(BigDecimal idcommande) {
        this.idcommande = idcommande;
    }

    public BigInteger getQuantite() {
        return quantite;
    }

    public void setQuantite(BigInteger quantite) {
        this.quantite = quantite;
    }

    public Date getDateReser() {
        return dateReser;
    }

    public void setDateReser(Date dateReser) {
        this.dateReser = dateReser;
    }

    public String getStatutreser() {
        return statutreser;
    }

    public void setStatutreser(String statutreser) {
        this.statutreser = statutreser;
    }

    public String getEtatcomm() {
        return etatcomm;
    }

    public void setEtatcomm(String etatcomm) {
        this.etatcomm = etatcomm;
    }

    public Utilisateur getIdutil() {
        return idutil;
    }

    public void setIdutil(Utilisateur idutil) {
        this.idutil = idutil;
    }

    public Item getIditem() {
        return iditem;
    }

    public void setIditem(Item iditem) {
        this.iditem = iditem;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idcommande != null ? idcommande.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Commandeclient)) {
            return false;
        }
        Commandeclient other = (Commandeclient) object;
        if ((this.idcommande == null && other.idcommande != null) || (this.idcommande != null && !this.idcommande.equals(other.idcommande))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.OneCommerceProject.entities.Commandeclient[ idcommande=" + idcommande + " ]";
    }
    
}
